package com.xuanzheng.company.service.impl;

import com.xuanzheng.company.dao.AnnouncementDao;
import com.xuanzheng.company.dao.impl.AnnouncementDaoImpl;
import com.xuanzheng.company.entity.Announcement;
import com.xuanzheng.company.service.AnnouncementService;
import com.xuanzheng.company.util.IdGenerator;

import java.util.List;

public class AnnouncementServiceImpl implements AnnouncementService {
    
    private final AnnouncementDao announcementDao;
    
    public AnnouncementServiceImpl() {
        this.announcementDao = new AnnouncementDaoImpl();
    }

    @Override
    public boolean addAnnouncement(Announcement announcement) {
        // 生成ID
        announcement.setId(IdGenerator.generateId());
        return announcementDao.addAnnouncement(announcement);
    }

    @Override
    public boolean updateAnnouncement(Announcement announcement) {
        return announcementDao.updateAnnouncement(announcement);
    }

    @Override
    public boolean deleteAnnouncement(String id) {
        return announcementDao.deleteAnnouncement(id);
    }

    @Override
    public Announcement getAnnouncementById(String id) {
        return announcementDao.getAnnouncementById(id);
    }

    @Override
    public List<Announcement> getAnnouncementsByCompanyId(String companyId) {
        return announcementDao.getAnnouncementsByCompanyId(companyId);
    }
} 